package com.sptan.framework.exception;

import com.sptan.framework.constans.SsmpConstants;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 文件.
 *
 * @author liupeng
 * @date 2024/5/5
 */
@RestController
public class ExceptionThrowController {
    @RequestMapping("/exception")
    public void returnThrow(HttpServletRequest request) throws Exception {
        // 从 Attribute 属性中取出异常对象，重新在 Controller 层抛出
        Exception e = (Exception)request.getAttribute(SsmpConstants.FILTER_ERROR_EXCEPTION);
        throw e;
    }
}
